cmake_minimum_required (VERSION 3.5)
project (tbsys)
set(CMAKE_CXX_STANDARD 11)
include_directories (include)
# set (SRC_LIST ${PROJECT_SOURCE_DIR}/src/tbtimeutil.cpp)
aux_source_directory (src SRC_LIST)
add_library (tbsys SHARED ${SRC_LIST})
add_library (tbsys_static STATIC ${SRC_LIST})
target_link_libraries (tbsys pthread)
# set_target_properties (tbsys_shared PROPERTIES OUTPUT_NAME "tbsys")
set_target_properties (tbsys_static PROPERTIES OUTPUT_NAME "tbsys")
set (LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib)
SET_TARGET_PROPERTIES (tbsys PROPERTIES VERSION 1.2 SOVERSION 1)

#test
find_library(tbsys HINTS ${PROJECT_SOURCE_DIR}/lib)

set (TEST_TIME_SRC_LIST ${PROJECT_SOURCE_DIR}/test/testtimeutil.cpp)
add_executable (test_timeutil ${TEST_TIME_SRC_LIST})
target_link_libraries (test_timeutil tbsys)

set (TEST_LOG_SRC_LIST ${PROJECT_SOURCE_DIR}/test/testlog.cpp)
add_executable (testlog ${TEST_LOG_SRC_LIST})
target_link_libraries (testlog tbsys)

set (TEST_FILEUTIL_SRC_LIST ${PROJECT_SOURCE_DIR}/test/testfileutil.cpp)
add_executable (testfileutil ${TEST_FILEUTIL_SRC_LIST})
target_link_libraries (testfileutil tbsys)

set (TEST_FILEQUEUE_SRC_LIST ${PROJECT_SOURCE_DIR}/test/testfilequeue.cpp)
add_executable (testfilequeue ${TEST_FILEQUEUE_SRC_LIST})
target_link_libraries (testfilequeue tbsys)

set (TEST_CONFIG_SRC_LIST ${PROJECT_SOURCE_DIR}/test/testconfig.cpp)
add_executable (testconfig ${TEST_CONFIG_SRC_LIST})
target_link_libraries (testconfig tbsys)

set (TEST_TIMER_SRC_LIST ${PROJECT_SOURCE_DIR}/test/testTimer.cpp)
add_executable (testtimer ${TEST_TIMER_SRC_LIST})
target_link_libraries (testtimer tbsys)

set (TEST_SERVICE_SRC_LIST ${PROJECT_SOURCE_DIR}/test/testService.cpp)
add_executable (testservice ${TEST_SERVICE_SRC_LIST})
target_link_libraries (testservice tbsys)

set (TEST_THREADPOOL_SRC_LIST ${PROJECT_SOURCE_DIR}/test/testThreadPool.cpp)
add_executable (testthreadpool ${TEST_THREADPOOL_SRC_LIST})
target_link_libraries (testthreadpool tbsys)

set (TEST_STRINGUTIL_SRC_LIST ${PROJECT_SOURCE_DIR}/test/teststringutil.cpp)
add_executable (teststringutil ${TEST_STRINGUTIL_SRC_LIST})
target_link_libraries (teststringutil tbsys)

set (TEST_THREAD_SRC_LIST ${PROJECT_SOURCE_DIR}/test/testthread.cpp)
add_executable (testthread ${TEST_THREAD_SRC_LIST})
target_link_libraries (testthread tbsys)

set (TEST_QUEUETHREAD_SRC_LIST ${PROJECT_SOURCE_DIR}/test/testqueuethread.cpp)
add_executable (testqueuethread ${TEST_QUEUETHREAD_SRC_LIST})
target_link_libraries (testqueuethread tbsys)

set (TEST_NETUTIL_SRC_LIST ${PROJECT_SOURCE_DIR}/test/testnetutil.cpp)
add_executable (testnetutil ${TEST_NETUTIL_SRC_LIST})
target_link_libraries (testnetutil tbsys)